{% extends 'stark/layout.html' %}

{% block css %}

<style>
.search-group {
    padding: 5px 10px;
}

.search-group .row a {
    display: inline-block;
    padding: 5px 8px;
    margin: 3px;
    border: 1px solid #d4d4d4;
}

.search-group .row .search-head {
    min-width: 40px;
    float: left;
    display: inline-block;
    padding: 5px 0 5px 8px;
    margin: 3px;
    font-weight: bold;
}

.search-group .row .search-body {
    padding-left: 60px;
}

.search-group a.active {
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
}
</style>

{% endblock %}

{% block content %}

    {% if search_group_data_list %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <i class="fa fa-filter" aria-hidden="true"></i> 快速筛选
        </div>
        <div class="panel-body search-group">
            {% for obj in search_group_data_list %}
            <div class="row">
            {% for item in obj %}
                {{ item|safe }}
            {% endfor %}
            </div>
            {% endfor %}
        </div>
    </div>
    {% endif %}

    {% if search_col_list %}
    <div style="float: right;">
        <form method="GET" class="form-inline">
            <div class="form-group">
                <input class="form-control" type="text" name="k" value='{{ k }}' placeholder="关键字搜索">
                <button class="btn btn-primary" type="submit">
                    <i class="fa fa-search" aria-hidden="true"></i>
                </button>
            </div>
        </form>
    </div>
    {% endif %}

    <form method="post">
    {% csrf_token %}

        {% if action_dict %}
        <div style="float: left;margin: 10px 30px 10px 0" class="form-inline">
            <select class="form-control" name="multi_action">
                <option>--请选择--</option>
                {% for func_name,func_text in action_dict.items %}
                <option value="{{ func_name }}">{{ func_text }}</option>
                {% endfor %}
            </select>
            <input class="btn btn-primary" type="submit" value="提交">
        </div>
        {% endif %}

        {% if add_btn %}
        <div style="margin: 10px 0;float: left">
            {{ add_btn|safe }}
        </div>
        {% endif %}

        <table class="table table-bordered">
        <thead>
            <tr>
                {% for head in head_list %}
                    <th>{{ head }}</th>
                {% endfor %}
            </tr>
        </thead>
        <tbody>
            {% for row in body_list %}
                <tr>
                    {% for ele in row %}
                        <td>{{ ele }}</td>
                    {% endfor %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
    </form>

    <nav>
        <ul class="pagination">
            {{ page.page_html|safe }}
        </ul>
    </nav>
{% endblock %}